// import fetch from 'node-fetch' 不适用node-fetch

/**
 * jira：工单地址
 * content：提测内容
 * img：提测二维码
 */
interface MSG {
  jira: string
  content: string
  img: string
}

export const sendMsg = ({ jira, img, content }: MSG): void => {
  void fetch('https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=feaedc98-8ead-4291-a6b5-b46eca0efc3e', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      msgtype: 'markdown',
      markdown: {
        content:
        `区域提测，请相关同事注意。\n> 类型:<font color="comment">小程序</font>\n> jira:<a href="${jira}" />\n> 工单详情:<font color="comment">${content}</font>\n>二维码：<img src="${img}" />`
      }
    })
  })
}
